<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item><router-link to="/customer/commemorationDay">客户纪念日管理</router-link></el-breadcrumb-item>
        <el-breadcrumb-item>客户纪念日详情</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <basic-container>
        <el-form style="padding: 40px;">
          <el-row :gutter="20" class="common-height">
            <el-col :span="6">
              <div class="grid-content bg-purple text-left">客户编码：{{categoryForm.customerSn}}</div>
            </el-col>
            <el-col :span="6">
              <div class="grid-content bg-purple text-left">客户联系人：{{categoryForm.linkmanName}}</div>
            </el-col>
            <el-col :span="6">
              <div class="grid-content bg-purple text-left">市场负责人：{{categoryForm.directorName}}</div>         
            </el-col>
            <el-col :span="6">
              <div class="grid-content bg-purple text-left">纪念日类型：{{anniversaryTypeList[categoryForm.anniversaryType]}}</div>
            </el-col>
          </el-row>
          <el-row :gutter="20" class="common-height">
            <el-col :span="6">
              <div class="grid-content bg-purple text-left">日历类型：{{calendarTypeList[categoryForm.calendarType]}}</div>
            </el-col>
            <el-col :span="6">
              <div class="grid-content bg-purple text-left">纪念日时间：{{categoryForm.anniversaryTime}}</div>
            </el-col>
            <el-col :span="6">
              <div class="grid-content bg-purple text-left">主题内容：{{categoryForm.content}}</div>         
            </el-col>
            <el-col :span="6">
              <div class="grid-content bg-purple text-left">备注：{{categoryForm.remarks}}</div>
            </el-col>
          </el-row>
        </el-form>
    </basic-container>
    
  </div>
</template>

<script>
  import {getStore, setStore} from "@/util/store";
  import {
    fetchList,
  } from '@/api/crm/customer'
  import {
    fetchList as linkman,
  } from '@/api/crm/customerlinkman' //联系人
  import {
    addDay,getDetail
  } from '@/api/crm/customeranniversary'
  import {
    mapGetters
  } from 'vuex'
  import {fetchDict} from '@/util/util';
  export default {
    data() {
      return {
        categoryForm:{
          photoList:[],
          position:''
        },
        custmoerList:[],
        manList:[],
        anniversaryTypeList: {
          '1': '公司',
          '2': '联系人',
        },
        calendarTypeList: {
          '1': '公历',
          '2': '农历',
        }
      }
    },
    computed: {
      ...mapGetters(['tagWel', 'tagList', 'tag', 'website']),
      tagLen() {
        return this.tagList.length || 0
      }
    },
    mounted() {

    },
    created(){
      this.getList();
      this.init();
    },
    methods: {
      init(){
        let params = JSON.parse(this.$route.query.res).id;
        getDetail(params).then(response => {
          this.categoryForm = response.data.data;
        })
      },
      //获取销售区域
      getList(page, params) {
        this.tableLoading = true
        fetchList({current: 1, size: 1000}).then(response => {
          this.custmoerList = response.data.data.records
        })
        linkman({current: 1, size: 1000}).then(response => {
          this.manList = response.data.data.records
        })
      },
      close(){
        var str_before = location.href.split('#')[1];
        let { tag, key } = this.findTag(str_before);
        this.$store.commit('DEL_TAG', tag);
        this.$router.go(-1);
      },
      findTag(value) {
        let tag, key
        this.tagList.map((item, index) => {
          if (item.value === value) {
            tag = item
            key = index
          }
        })
        return { tag: tag, key: key }
      }
    }
  }
</script>

<style scoped lang="scss">
.crumbs{
    margin: 20px 10px;
  }
.text-left {
    text-align: left;
    margin-left: 10px;
  }
</style>


